<template>
  <div>
    <h1 align="center">会员列表</h1>
    名称:
    <input type="text"  v-model="state.hname"/>
    年龄
    <input type="date" v-model="state.date1" />-<input type="date"  v-model="state.date2" />
    <input type="button" value="查询" class="btn btm-denger" @click="Show" />
    <table class="table table-bordered">
      <tr>
        <td>会员名称</td>
        <td>出生日期</td>
        <td>状态</td>
        <td>性别</td>
        <td>积分余额</td>
        <td>姓名</td>
        <td>操作</td>
      </tr>
      <tr v-for="item in list">
        <td>{{item.m_user}}</td>
        <td>{{item.m_date.substr(0,10)}}</td>
        <td>{{item.isDelte==1?'禁用':'启用'}}</td>   
        <td>{{item.m_sex}}</td>
        <td>{{item.m_menony}}</td>
        <td>{{item.m_name}}</td>
        <td>操作</td>
      </tr>
    </table>
  </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { reactive, toRefs, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useRoute } from 'vue-router';
const router = useRouter();
const route = useRoute();

let data:any = reactive({
  state: {
    hname: '',
    date1: '',
    date2: ''
  },
  list:[]
})
let {state,list} = toRefs(data)
//文档就绪
onMounted (()=>{
  Show();
})
//显示
const Show=()=>{
  let obj ={
    hname:state.value.hname,
    date1:state.value.date1,
    date2:state.value.date2
  }
  axios({
   url:'/api/Meber/Show',
   method:'get',
   params:obj
  })
  .then((res)=>{
    console.log(res); 
    list.value = res.data.data;
  })
  .catch((err)=>{
    console.log(err);
  })  
}
</script>

<style scoped></style>
